import axios from 'axios'
import { server, timeout } from './data.js'
const user = {
    openId: localStorage.getItem('openId'),
    salesId:localStorage.getItem('salesId'),
    co:localStorage.getItem('co'),
}

/*
/ appHealthCheckUpOrder/ selectPartyDetail
体检机构详情
 */
export const selectPartyDetail = (params = {}) => {
    params = {
        ...user,
        ...params
    };
    return new Promise((resolve, reject) => {
        axios.get(`${server}/appHealthCheckUpOrder/selectPartyDetail`, {
            params,
            timeout
        }).then(function(response) {
            resolve(response.data)
        }).catch(function(error) {
            reject(error);
        });
    });
}
/*
/ appHealthCheckUpOrder/ updateCheckUpParty
预约
 */
export const updateCheckUpParty = (params = {}) => {
    params = {
        ...user,
        ...params
    };
    return new Promise((resolve, reject) => {
        axios.get(`${server}/appHealthCheckUpOrder/updateCheckUpParty`, {
            params,
            timeout
        }).then(function(response) {
            resolve(response.data)
        }).catch(function(error) {
            reject(error);
        });
    });
}
//体检预约
export const selectPolicyNoStatus = (params = {}) => {
    params = {
        ...user,
        ...params
    };
    return new Promise((resolve, reject) => {
        axios.get(`${server}/appHealthCheckUpOrder/selectPolicyNoStatus`, {
            params,
            timeout
        }).then(function(response) {
            resolve(response.data)
        }).catch(function(error) {
            reject(error);
        });
    });
}


//展示营销员所在分公司下并能完成此次体检项目的所有体检机构(医院)
export const selectParty = (params = {}) => {
    params = {
        ...user,
        ...params
    };
    return new Promise((resolve, reject) => {
        axios.get(`${server}/appHealthCheckUpOrder/selectParty`, {
            params,
            timeout
        }).then(function(response) {
            resolve(response.data)
        }).catch(function(error) {
            reject(error);
        });
    });
}



/*-----------------------------------------------------------*/

//查询预约记录列表
export const selectOrderCheckUpList = (params = {}) => {
    params = {
        ...user,
        ...params
    };
    return new Promise((resolve, reject) => {
        axios.get(`${server}/appHealthCheckUpOrder/selectOrderCheckUpList`, {
            params,
            timeout
        }).then(function(response) {
            resolve(response.data)
        }).catch(function(error) {
            reject(error);
        });
    });
}


//查询预约记录表详情
export const selectOrderCheckUpListDetail = (params = {}) => {
    params = {
        ...user,
        ...params
    };
    return new Promise((resolve, reject) => {
        axios.get(`${server}/appHealthCheckUpOrder/selectOrderCheckUpListDetail`, {
            params,
            timeout
        }).then(function(response) {
            resolve(response.data)
        }).catch(function(error) {
            reject(error);
        });
    });
}


//取消预约/完成体检/取消体检
export const updateStatusIdToCancell = (params = {}) => {
    params = {
        ...user,
        ...params
    };
    return new Promise((resolve, reject) => {
        axios.get(`${server}/appHealthCheckUpOrder/updateStatusIdToCancell`, {
            params,
            timeout
        }).then(function(response) {
            resolve(response.data)
        }).catch(function(error) {
            reject(error);
        });
    });
}

//查询待预约体检记录
export const selectWaitingOrder = (params = {}) => {
    params = {
        ...user,
        ...params
    };
    return new Promise((resolve, reject) => {
        axios.get(`${server}/appHealthCheckUpOrder/selectWaitingOrder`, {
            params,
            timeout
        }).then(function(response) {
            resolve(response.data)
        }).catch(function(error) {
            reject(error);
        });
    });
}